package com.share.design.composite;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * author:caifan
 * date:2020/2/5
 */
@Data
@AllArgsConstructor
public class Goods implements Articles {
    private String name;
    private Integer quantity;
    private float unitPrice;

    @Override
    public float calculate() {
        return quantity * unitPrice;
    }

    @Override
    public void show() {
        System.out.println(name + ":" + calculate());
    }
}
